# Copyright (C) 2006 Johann C. Rocholl <johann@browsershots.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Factory configuration.
"""

__revision__ = '$Rev: 406 $'
__date__ = '$Date: 2006-06-11 15:42:19 +0000 (Sun, 11 Jun 2006) $'
__author__ = '$Author: johann $'

from shotserver03 import database

export_methods = ['features']

def features(factory):
    """
    features(string) => string
    Generate an SQL WHERE clause that matches requests for a given factory.

    Parameter:
    - The name of the factory (string, length max 20).

    Return value:
    - SQL WHERE clause (string).
    """
    database.connect()
    try:
        factory = database.factory.select_serial(factory)
        return database.factory.features(factory)
    finally:
        database.disconnect()
